package com.mo.controller;

import com.mo.entity.Student;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Duration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author moon.pan
 * @program mo-all
 * @apiNote
 * @since 2022/4/20
 */
@RestController
@RequestMapping("info")
@ConfigurationProperties("info")
public class InfoController {

    private Map<String, Duration> map = new HashMap<>();

    private List<Student> configs = new ArrayList<>();

    @Value("${info.emails:a@qq.com, b@qq.com}")
    private List<String> emails;

    @Value("${spring.application.name:}")
    private String value;

    @GetMapping
    public Map<String, Duration> info() {
        System.out.println(configs);
        return map;
    }

    public void setConfigs(List<Student> configs) {
        this.configs = configs;
    }

    public void setMap(Map<String, Duration> map) {
        this.map = map;
    }
}
